import React from 'react';
import { BrowserRouter as Router, Routes, Route, Navigate } from 'react-router-dom';
import { ConfigProvider } from 'antd';
import zhCN from 'antd/locale/zh_CN';
import MainLayout from './layouts/MainLayout';
import Dashboard from './pages/Dashboard';
import Accounts from './pages/Accounts';
import Competitor from './pages/Competitor';
import Content from './pages/Content';
import Publish from './pages/Publish';
import Analytics from './pages/Analytics';
import Settings from './pages/Settings';
import { AccountProvider } from './components/AccountProvider';

// 导入antd样式
import 'antd/dist/reset.css';

const App: React.FC = () => {
  return (
    <ConfigProvider locale={zhCN}>
      <AccountProvider>
        <Router>
          <Routes>
            <Route path="/" element={<MainLayout />}>
              <Route index element={<Navigate to="/dashboard" replace />} />
              <Route path="dashboard" element={<Dashboard />} />
              <Route path="accounts" element={<Accounts />} />
              <Route path="competitor" element={<Competitor />} />
              <Route path="content" element={<Content />} />
              <Route path="publish" element={<Publish />} />
              <Route path="analytics" element={<Analytics />} />
              <Route path="settings" element={<Settings />} />
              <Route path="*" element={<Navigate to="/dashboard" replace />} />
            </Route>
          </Routes>
        </Router>
      </AccountProvider>
    </ConfigProvider>
  );
};

export default App;
